package LeetCode.month03.day64;

import java.util.Arrays;

/**
 * @author 16778
 * @version 1.0
 * @date 2025/9/28 9:43
 */
public class No976 {
    public int largestPerimeter(int[] nums) {
        Arrays.sort(nums);
        for (int i = nums.length - 1; i-2 >= 0; i--) {
            int x1 = nums[i-2];
            int x2 = nums[i-1];
            int x3 = nums[i];
            if (x1 + x2 > x3) {
                return x1 + x2 + x3;
            }
        }
        return 0;
    }
}
